/**
 * @FileName Client.java
 * @Package com.designMode.command
 * -------------------------------------
 * @function Please write description of function
 * @Date 2016-1-6 上午11:53:14
 * -------------------------------------
 * Copyright (c) 2016,顾博君 All Rights Reserved.
 */
package com.designMode.command;

/**
 * @author 顾博君
 * @ClassName Client
 * @Date 2016-1-6 上午11:53:14
 * @Function 场景类
 */
public class Client {
    public static void main(String[] args) {
        // 新建调用者类
        Invoker invoker = new Invoker();
        // 新建接收者类
        Receiver receiver1 = new ConcreteReceiver("Rec1");
        Receiver receiver2 = new ConcreteReceiver("Rec2");
        // 新建命令类
        Command command1 = new ConcreteCommand(receiver1, "Cmd1");
        Command command2 = new ConcreteCommand(receiver1, "Cmd2");
        Command command3 = new ConcreteCommand(receiver2, "Cmd3");
        // 调用者设置命令
        invoker.setCommand(command1);
        // 调用者执行命令
        invoker.action();
        // 调用者设置命令
        invoker.setCommand(command2);
        // 调用者执行命令
        invoker.action();
        // 调用者设置命令
        invoker.setCommand(command3);
        // 调用者执行命令
        invoker.action();
    }
}
